import Vue from 'vue' // 引入Vue框架
import Router from 'vue-router' // 引入路由管理器
import Website from '../components/website/website'
import Home from '../components/website/Home'
import Mall from '../components/website/Mall'
import Error from '../components/Error'
import ModifyPassword from '../components/ModifyPassword'
import Login from '../components/Login'
import Layout from '../components/layout/Layout'
import User from '../components/layout/User'
import Cover from '../components/layout/Cover'
import CoverType from '../components/layout/CoverType'
import Goods from '../components/layout/Goods'
import GoodsType from '../components/layout/GoodsType'
import WxOrder from '../components/layout/WxOrder'
import Log from '../components/layout/Log'
import Mail from '../components/layout/Mail'

/**
 * 全局路由配置
 */
const appRoutes = [
  {path: '/', redirect: '/website'},
  {
    path: '/website',
    component: Website,
    redirect: '/website/home',
    children: [
      {path: '/website/home', component: Home},
      {path: '/website/mall', component: Mall}
    ]
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/user',
    children: [
      {path: '/layout/user', component: User},
      {path: '/layout/cover', component: Cover},
      {path: '/layout/coverType', component: CoverType},
      {path: '/layout/goods', component: Goods},
      {path: '/layout/goodsType', component: GoodsType},
      {path: '/layout/wxOrder', component: WxOrder},
      {path: '/layout/log', component: Log},
      {path: '/layout/mail', component: Mail}
    ]
  },
  {path: '/error', name: 'Error', component: Error},
  {path: '/modifyPassword', name: 'ModifyPassword', component: ModifyPassword},
  {path: '/login', name: 'Login', component: Login},
  {path: '*', redirect: '/error'}
];

Vue.use(Router); // 注册vue-router路由管理器
export default new Router({
  routes: appRoutes
})
